<?php

namespace App\Kuafu\Product\Enum;

use App\Kuafu\Base\Enum\BaseCodeEnum;

class ProductCacheEnum extends BaseCodeEnum
{
    private const PRODUCT_LIST                = 'product-list';
    private const CUSTOM_PRODUCT_PACKAGE_LIST = 'customer-product-package-list';
    private const SHOP_CUSTOM_PRODUCT_NUM     = "shopCustomProductNum:shopId:%d";

    /**
     * 菜单下的菜品列表
     * @param int $menuId
     * @return string
     */
    public static function getProductList(int $menuId): string
    {
        return sprintf(self::PRODUCT_LIST . ":%d", $menuId);
    }

    /**
     * 自定义公共菜品库的数据
     * @return string
     */
    public static function getCustomPublicProductList(): string
    {
        return sprintf(self::PRODUCT_LIST . "-public");
    }

    /**
     * 自定义套餐数据 Key
     * @param int $menuId
     * @return string
     */
    public static function getCustomProductPackageList(int $shopId): string
    {
        return sprintf(self::CUSTOM_PRODUCT_PACKAGE_LIST . ":%d", $shopId);
    }

    /**
     * @param int $shopId
     * @return string
     */
    public static function getShopCustomProductNumCacheKey(int $shopId): string
    {
        return sprintf(self::SHOP_CUSTOM_PRODUCT_NUM, $shopId);
    }
}
